package com.qf.controller;

import com.qf.pojo.User;
import com.qf.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Date;
import java.util.List;

@Controller
@RequestMapping(path = "user")
public class UserController {
    @Autowired
    private UserService userService;
    @RequestMapping(path = "show")
    public String show(Model model){
        model.addAttribute("hello","1");
        model.addAttribute("msg","hello_HELLO");
        model.addAttribute("sex","男");
        model.addAttribute("birth",new Date());
        return "test";

    }


    @RequestMapping("list")
    public String list(Model model){
        List<User> list = userService.list();
        model.addAttribute("list",list);
        return "demo02";

}
}
